package com.biannuo.szk.demo.provider.feign;

import com.biannuo.szk.common.bean.ComplexObject;
import com.biannuo.szk.common.bean.Params;
import com.biannuo.szk.common.bean.Result;
import com.biannuo.szk.demo.provider.fallback.DemoProviderClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

/**
 * 表示调用服务名为 openfeign-provider-sample fallback 异常、限流等的自定义处理逻辑在OpenFeignTestServiceFallback类中
 *
 * @author szk
 */
@FeignClient(value = "szk-demo-provider", fallback = DemoProviderClientFallback.class)
public interface DemoProviderClient {
    /**
     * openFeignProviderTest接口
     *
     * @return 字符中
     */
    @RequestMapping(value = "/openFeignProviderTest", method = RequestMethod.GET)
    String openFeignProviderTest();

    /**
     * sampleParamsProviderTest
     *
     * @param name
     * @param id
     * @return
     */
    @PostMapping("/sampleParamsProviderTest")
    String sampleParamsProviderTest(@RequestParam("name") String name, @RequestParam("id") Integer id);

    /**
     * springQueryMapProviderTest
     *
     * @param params
     * @return
     */
    @GetMapping("/springQueryMapProviderTest")
    String springQueryMapProviderTest(@SpringQueryMap Params params);

    /**
     * complexObjectProviderTest
     *
     * @param complexObject
     * @return
     */
    @PostMapping("/complexObjectProviderTest")
    Result complexObjectProviderTest(@RequestBody ComplexObject complexObject);

}